import {getBase64Auth, ncOptions} from "../common";
const request = require('request-promise')
const config = require('config')
const nextcloud = config.get('nextcloud')

export const getFileActivity = async (client, user, fileid)=>{
    let options = {...ncOptions},result
    options.uri = `${nextcloud.host}/ocs/v2.php/apps/activity/api/v2/activity/filter?format=json&object_type=files&object_id=${fileid}`
    options.headers.Authorization = getBase64Auth(user.id, user.passwd)
    options.method = 'GET'
    result = await request(options)
    result = result.ocs&&result.ocs.data
    return result
}
